package com.csun.cmny.provider.utils;


import java.text.SimpleDateFormat;
import java.util.Date;

public class OnOffTimeUtil {



    public static boolean isBusiness(String onTimes,String offTimes){


        //判定当前时间是否是上班时间
        String[] onTime = onTimes.split(":");
        String[] offTime = offTimes.split(":");
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy-MM-dd HH:mm");
        String format = simpleDateFormat.format(new Date());
        String HH = format.substring(9, 11);
        String mm = format.substring(12,14);

        if (Integer.valueOf(HH)<Integer.valueOf(onTime[0])){
            return false;
        }
        if (Integer.valueOf(HH)==Integer.valueOf(onTime[0])){
            if(Integer.valueOf(mm)<Integer.valueOf(onTime[1])){
                return false;
            }
        }

        if(Integer.valueOf(HH)>Integer.valueOf(offTime[0])){
            return false;
        }
        if(Integer.valueOf(HH)==Integer.valueOf(offTime[0])){
            if(Integer.valueOf(mm)>Integer.valueOf(offTime[1])){
                return false;
            }
        }

        return true;

    }
}
